From: Richard M. Stallman Date: Mon, 20 Jan 2003 09:02:28 +0000 (+0000) Subject: (completion-setup-function): Set default-directory X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~28718 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=25ad6b121301803335f7edbe31c731b12c760326;p=emacs.git (completion-setup-function): Set default-directory in the minibuffer, so it'll be copied into the completion list buffer. --- diff --git a/lisp/simple.el b/lisp/simple.el index 39b2631d2b6..c0028a08233 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3959,7 +3959,14 @@ The completion list buffer is available as the value of `standard-output'.") (defun completion-setup-function () (save-excursion - (let ((mainbuf (current-buffer))) + (let ((mainbuf (current-buffer)) + (mbuf-contents (minibuffer-contents))) + ;; When reading a file name in the minibuffer, + ;; set default-directory in the minibuffer + ;; so it will get copied into the completion list buffer. + (if minibuffer-completing-file-name + (with-current-buffer mainbuf + (setq default-directory (file-name-directory mbuf-contents)))) (set-buffer standard-output) (completion-list-mode) (make-local-variable 'completion-reference-buffer)